package com.byjh.common.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "aliyun.oss")
@Data
public class OssConfig {

    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }

    private String endpoint; //阿里云OSS地址
    private String accessKeyId; //阿里云AccessKeyId
    private String accessKeySecret; //阿里云AccessKeySecret
    private String bucketName; //阿里云Bucket名称


}
